# Article Title: Female Representation in Legislative Committees and Perceptions of Legitimacy: Evidence from a Harmonized Experiment in Jordan, Morocco, and Tunisia
# Authors: Kritsen Kao, Ellen Lust, Marwa Shalaby, and Chagai Weiss
# Purpose: Code for Dataverse appendix of table format results for appendix figures


#Load Relevant packages------
library("tidyverse")
library("estimatr")
library("ggplot2")
library("effectsize")
library("ggthemes")
library("texreg")
library("ltm")
library("stargazer")
library("RItools")
library("xtable")
library("MASS")
library("modelsummary")

#Read in data----
gend_dat <- readRDS("replication_data/data_for_analysis.rds")
gend_domv <-
 gend_dat %>% 
 filter(.,
        d_issue_dv == 1)



#Table format results of Figure A5------
##Outcome: Right Decision-----
h5a_sxsm_rt_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 

h5a_sxsm_rt_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_sxsm_rt_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_sxsm_rt_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
h5a_sxsm_att_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

h5a_sxsm_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


h5a_sxsm_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)


h5a_sxsm_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Acceptance of Committee Decision------

h5a_sxsm_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

h5a_sxsm_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

h5a_sxsm_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_sxsm_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 



###Create Table for A5-----
texreg(list(h5a_sxsm_rt_dec_pool, h5a_sxsm_rt_dec_jrd, h5a_sxsm_rt_dec_tns, h5a_sxsm_rt_dec_mrc,
            h5a_sxsm_att_cmt_pool, h5a_sxsm_att_cmt_jrd, h5a_sxsm_att_cmt_tns, h5a_sxsm_att_cmt_mrc,
            h5a_sxsm_accpt_cmt_pool, h5a_sxsm_accpt_cmt_jrd, h5a_sxsm_accpt_cmt_tns, h5a_sxsm_accpt_cmt_mrc),
       label = "tab:figure_a5",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Overall Sexism on Gender Balance (Figure A5)",
       font.size = "scriptsize",
       sideways = T)



#Table format results of Figure A6------
##Outcome: Right Decision------
h5a_hs_sxsm_rt_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 

h5a_hs_sxsm_rt_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_hs_sxsm_rt_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_hs_sxsm_rt_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
h5a_hs_sxsm_att_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

h5a_hs_sxsm_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_hs_sxsm_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

h5a_hs_sxsm_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Acceptance of Committee Decision------

h5a_hs_sxsm_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

h5a_hs_sxsm_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

h5a_hs_sxsm_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


h5a_hs_sxsm_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_hos_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

###Create Table for A6-----
texreg(list(h5a_hs_sxsm_rt_dec_pool, h5a_hs_sxsm_rt_dec_jrd, h5a_hs_sxsm_rt_dec_tns, h5a_hs_sxsm_rt_dec_mrc,
            h5a_hs_sxsm_att_cmt_pool, h5a_hs_sxsm_att_cmt_jrd, h5a_hs_sxsm_att_cmt_tns, h5a_hs_sxsm_att_cmt_mrc,
            h5a_hs_sxsm_accpt_cmt_pool, h5a_hs_sxsm_accpt_cmt_jrd, h5a_hs_sxsm_accpt_cmt_tns, h5a_hs_sxsm_accpt_cmt_mrc),
       label = "tab:figure_a6",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Hostile Sexism on Gender Balance (Figure A6)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


#Table format Results of Figure A7------
##Outcome: Right Decision------
h5a_bn_sxsm_rt_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 

h5a_bn_sxsm_rt_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


h5a_bn_sxsm_rt_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_bn_sxsm_rt_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
h5a_bn_sxsm_att_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

h5a_bn_sxsm_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5a_bn_sxsm_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

h5a_bn_sxsm_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 
## Outcome: Acceptance of Committee Decision------

h5a_bn_sxsm_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


h5a_bn_sxsm_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

h5a_bn_sxsm_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 



h5a_bn_sxsm_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_ben_sexism_ix + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


###Create Table for A7-----
texreg(list(h5a_bn_sxsm_rt_dec_pool, h5a_bn_sxsm_rt_dec_jrd, h5a_bn_sxsm_rt_dec_tns, h5a_bn_sxsm_rt_dec_mrc,
            h5a_bn_sxsm_att_cmt_pool, h5a_bn_sxsm_att_cmt_jrd, h5a_bn_sxsm_att_cmt_tns, h5a_bn_sxsm_att_cmt_mrc,
            h5a_bn_sxsm_accpt_cmt_pool, h5a_bn_sxsm_accpt_cmt_jrd, h5a_bn_sxsm_accpt_cmt_tns, h5a_bn_sxsm_accpt_cmt_mrc),
       label = "tab:figure_a7",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Benevolent Sexism on Gender Balance (Figure A7)",
       font.size = "scriptsize",
       table = T,
       sideways = T)



#Table format result for Figure A8-----
## Recode sexism index as binary (below/above mean)------
mean(gend_domv$m_sexism_ix, na.rm = T)
gend_domv<-
 gend_domv %>% 
 mutate(.,
        m_sexism_ba = case_when(
         m_sexism_ix > 0.6299239 ~ 1,
         m_sexism_ix < 0.6299239 ~ 0
        ))
##Outcome: Right Decision------
bin_sxsm_rt_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 

bin_sxsm_rt_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

bin_sxsm_rt_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

bin_sxsm_rt_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
bin_sxsm_att_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

bin_sxsm_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

bin_sxsm_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

bin_sxsm_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

## Outcome: Acceptance of Committee Decision------

bin_sxsm_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

bin_sxsm_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

bin_sxsm_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

bin_sxsm_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_sexism_ba + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


###Create table for a8------
texreg(list(bin_sxsm_rt_dec_pool, bin_sxsm_rt_dec_jrd, bin_sxsm_rt_dec_tns, bin_sxsm_rt_dec_mrc,
            bin_sxsm_att_cmt_pool, bin_sxsm_att_cmt_jrd, bin_sxsm_att_cmt_tns, bin_sxsm_att_cmt_mrc,
            bin_sxsm_accpt_cmt_pool, bin_sxsm_accpt_cmt_jrd, bin_sxsm_accpt_cmt_tns, bin_sxsm_accpt_cmt_mrc),
       label = "tab:figure_a8",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Sexism (Binary) on Gender Balance (Figure A8)",
       font.size = "scriptsize",
       table = T,
       sideways = T)



#Table format Results for Figure A9--------
##Outcome: Committee Made Right decision (Index)-----

h5b_rt_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_norms_ix + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 

h5b_rt_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5b_rt_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

h5b_rt_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


##Outcome: Attitudes Towards Committee (Index)-----
h5b_att_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

h5b_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 



h5b_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)


h5b_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


## Outcome: Acceptance of Committee Decision------

h5b_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

h5b_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

h5b_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 



h5b_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_norms_ix+d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

###Create table for a9------
texreg(list(h5b_rt_dec_pool, h5b_rt_dec_jrd, h5b_rt_dec_tns, h5b_rt_dec_mrc,
            h5b_att_cmt_pool, h5b_att_cmt_jrd, h5b_att_cmt_tns, h5b_att_cmt_mrc,
            h5b_accpt_cmt_pool, h5b_accpt_cmt_jrd, h5b_accpt_cmt_tns, h5b_accpt_cmt_mrc),
       label = "tab:figure_a9",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Perceptions of Gender Norms on Gender Balance (Figure A9)",
       font.size = "scriptsize",
       table = T,
       sideways = T)

#Table format results for Figure A10-----
##Outcome: Committee Made Right decision (Index)-----
rt_dec_ml_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*x_male + d_pro_dec+
            x_age + x_edu,
           se_type = "HC0",
           fixed_effects = x_cntry,
           data = .) 

rt_dec_ml_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*x_male + d_pro_dec+
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


rt_dec_ml_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*x_male + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


rt_dec_ml_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*x_male + d_pro_dec +  
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
att_cmt_ml_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*x_male + d_pro_dec +
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


att_cmt_ml_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*x_male + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

att_cmt_ml_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*x_male + d_pro_dec +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

att_cmt_ml_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*x_male + d_pro_dec +  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


## Outcome: Acceptance of Committee Decision------

accpt_cmt_ml_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*x_male + d_pro_dec +
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


accpt_cmt_ml_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*x_male + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .)


accpt_cmt_ml_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*x_male + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


accpt_cmt_ml_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*x_male + d_pro_dec +  
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



###Create table for a10------
texreg(list(rt_dec_ml_pool, rt_dec_ml_jrd, rt_dec_ml_tns, rt_dec_ml_mrc,
            att_cmt_ml_pool, att_cmt_ml_jrd, att_cmt_ml_tns, att_cmt_ml_mrc,
            accpt_cmt_ml_pool, accpt_cmt_ml_jrd, accpt_cmt_ml_tns, accpt_cmt_ml_mrc),
       label = "tab:figure_a10",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Gender on Gender Balance (Figure A10)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


#Table format results for figure A11-----
## Create Weights for missingness in each outcome----
# Set missing covariates at 99
gend_domv <- 
 gend_domv %>% 
 mutate(.,
        avail_h1 = ifelse(is.na(y_right_dec_ix),0,1),
        avail_h2 = ifelse(is.na(y_att_comittee),0,1),
        avail_h3 = ifelse(is.na(y_public_accept),0,1),
        wx_age = ifelse(is.na(x_age), 99,x_age),
        wx_edu = ifelse(is.na(x_edu), "Missing",x_edu),
        wx_male = ifelse(is.na(x_male), 99,x_male),
        wx_cntry = ifelse(is.na(x_cntry), "Missing",x_cntry),
        wdemo_q7 = ifelse(is.na(demo_q7), "Missing",demo_q7),
        wdemo_q8 = ifelse(is.na(demo_q8), "Missing",demo_q8),
        wm_sexism_ix = ifelse(is.na(m_sexism_ix), 99,m_sexism_ix),
        wm_norms_ix = ifelse(is.na(m_norms_ix), 99,m_norms_ix))

### Outcome in H1
fit_p_out1 <- 
 glm(avail_h1 ~ d_gen_bal*wx_age + d_gen_bal*wx_edu +
      d_gen_bal*wx_male +  d_gen_bal*wx_cntry + 
      d_gen_bal*wdemo_q7 +  d_gen_bal*wdemo_q8 +
      d_gen_bal*wm_sexism_ix +  d_gen_bal*wm_norms_ix +
      d_pro_dec*wx_age + d_pro_dec*wx_edu +
      d_pro_dec*wx_male +  d_pro_dec*wx_cntry + 
      d_pro_dec*wdemo_q7 +  d_pro_dec*wdemo_q8 +
      d_pro_dec*wm_sexism_ix +  d_pro_dec*wm_norms_ix +
      d_pro_dec*d_gen_bal,
     family = binomial(link = "logit"),
     data = gend_domv)
p_out1 <- fit_p_out1$fitted
wght_h1 <- 1/p_out1

### Outcome in H2
fit_p_out2 <- 
 glm(avail_h2 ~ d_gen_bal*wx_age + d_gen_bal*wx_edu +
      d_gen_bal*wx_male +  d_gen_bal*wx_cntry + 
      d_gen_bal*wdemo_q7 +  d_gen_bal*wdemo_q8 +
      d_gen_bal*wm_sexism_ix +  d_gen_bal*wm_norms_ix +
      d_pro_dec*wx_age + d_pro_dec*wx_edu +
      d_pro_dec*wx_male +  d_pro_dec*wx_cntry + 
      d_pro_dec*wdemo_q7 +  d_pro_dec*wdemo_q8 +
      d_pro_dec*wm_sexism_ix +  d_pro_dec*wm_norms_ix +
      d_pro_dec*d_gen_bal,
     family = binomial(link = "logit"),
     data = gend_domv)
p_out2 <- fit_p_out2$fitted
wght_h2 <- 1/p_out2


### Outcome in H3
fit_p_out3 <- 
 glm(avail_h3 ~ d_gen_bal*wx_age + d_gen_bal*wx_edu +
      d_gen_bal*wx_male +  d_gen_bal*wx_cntry + 
      d_gen_bal*wdemo_q7 +  d_gen_bal*wdemo_q8 +
      d_gen_bal*wm_sexism_ix +  d_gen_bal*wm_norms_ix +
      d_pro_dec*wx_age + d_pro_dec*wx_edu +
      d_pro_dec*wx_male +  d_pro_dec*wx_cntry + 
      d_pro_dec*wdemo_q7 +  d_pro_dec*wdemo_q8 +
      d_pro_dec*wm_sexism_ix +  d_pro_dec*wm_norms_ix +
      d_pro_dec*d_gen_bal,
     family = binomial(link = "logit"),
     data = gend_domv)
p_out3 <- fit_p_out3$fitted
wght_h3 <- 1/p_out3

##Outcome: Committee Made Right Decision (Index)-----
h1_w_ix <-
 gend_domv %>%
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal +d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           weights = wght_h1,
           data = .) 
h1_nw_ix <-
 gend_domv %>%
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal +d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 

###Outcome: Attitudes toward Committee (Index)-----
h2_w_ix <-
 gend_domv %>%
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal +d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           weights = wght_h2,
           data = .) 

h2_nw_ix <-
 gend_domv %>%
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal +d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 


##Outcome: Acceptance of Committee Decision-----
h3_w <-
 gend_domv %>%
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal +d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           weights = wght_h3,
           data = .) 


h3_nw <-
 gend_domv %>%
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal +d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 


###Create table for A11-----
texreg(list(h1_w_ix, h1_nw_ix, 
            h2_w_ix, h2_nw_ix, 
            h3_w, h3_nw),
       label = "tab:figure_a11",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:2,
                            "Attitude Committee" = 3:4,
                            "Public Accept" = 5:6),
       custom.model.names	= c("W", "Not W", 
                              "W", "Not W", 
                              "W", "Not W"),
       fontsize = "scriptsize",
       caption = "Inverse Probability Models (Figure A11)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


#Table format results for Figure A14-----

##Outcome: Committee Made Right decision (Index)-----
end_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            endog_comitt_gend_bal+ endog_comitt_support+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 

end_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            endog_comitt_gend_bal + endog_comitt_support+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


end_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            endog_comitt_gend_bal + endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


end_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            endog_comitt_gend_bal + endog_comitt_support +  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
end_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            endog_comitt_gend_bal + endog_comitt_support +
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


end_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            endog_comitt_gend_bal + endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

end_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            endog_comitt_gend_bal + endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)



end_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            endog_comitt_gend_bal + endog_comitt_support +  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


## Outcome: Acceptance of Committee Decision------

end_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            endog_comitt_gend_bal + endog_comitt_support +
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


end_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            endog_comitt_gend_bal + endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)


end_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            endog_comitt_gend_bal + endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


end_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            endog_comitt_gend_bal + endog_comitt_support +  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


###Create table for a14------
texreg(list(end_dec_pool, end_dec_jrd, end_dec_tns, end_dec_mrc,
            end_cmt_pool,end_att_cmt_jrd,end_att_cmt_tns,end_att_cmt_mrc,
            end_accpt_cmt_pool, end_accpt_cmt_jrd,end_accpt_cmt_tns,end_accpt_cmt_mrc),
       label = "tab:figure_a10",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Correlation of Perceived Gender Balance and Committee Decision with Key Outcomes (Figure A14)",
       font.size = "scriptsize",
       table = T,
       sideways = T)



#Table format result for Figure A15---------

##Outcome: Committee Made Right decision (Index)-----
en_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*endog_comitt_support+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           data = .) 
en_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*endog_comitt_support+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


en_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 




en_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*endog_comitt_support +  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


##Outcome: Attitudes Towards Committee (Index)-----
en_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*endog_comitt_support +
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


en_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


en_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)




en_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*endog_comitt_support +  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 




## Outcome: Acceptance of Committee Decision------

en_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*endog_comitt_support +
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


en_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)

en_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*endog_comitt_support +
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

en_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*endog_comitt_support +  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


###Create table for a15------
texreg(list(en_dec_pool, en_dec_jrd, en_dec_tns, en_dec_mrc,
            en_cmt_pool,en_att_cmt_jrd,en_att_cmt_tns,en_att_cmt_mrc,
            en_accpt_cmt_pool, en_accpt_cmt_jrd,en_accpt_cmt_tns,en_accpt_cmt_mrc),
       label = "tab:figure_a15",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Perceived Committee Support on Gender Balance (Figure A15)",
       font.size = "scriptsize",
       table = T,
       sideways = T)



#Table format results for Figure A16----
##Outcome: Committee Made Right decision (Index)-----
rt_dec_ml_pool_en <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec+
            x_age + x_edu + x_cong_en,
           fixed_effects = x_cntry,
           data = .)


rt_dec_ml_jrd_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec+
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .)


rt_dec_ml_tns_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .) 



rt_dec_ml_mrc_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
att_cmt_ml_pool_en <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .) 


att_cmt_ml_jrd_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .)


att_cmt_ml_tns_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .)


att_cmt_ml_mrc_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .) 


## Outcome: Acceptance of Committee Decision------

accpt_cmt_ml_pool_en <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .)




accpt_cmt_ml_jrd_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .) 


accpt_cmt_ml_tns_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .) 



accpt_cmt_ml_mrc_en <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_cong_en,
           se_type = "HC0",
           data = .) 


###Create table for a16------
texreg(list(rt_dec_ml_pool_en, rt_dec_ml_jrd_en, rt_dec_ml_tns_en, rt_dec_ml_mrc_en,
            att_cmt_ml_pool_en, att_cmt_ml_jrd_en, att_cmt_ml_tns_en, att_cmt_ml_mrc_en,
            accpt_cmt_ml_pool_en, accpt_cmt_ml_jrd_en, accpt_cmt_ml_tns_en, accpt_cmt_ml_mrc_en),
       label = "tab:figure_a16",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Main Results Controlling for Enumerator-Respondent Gender Congruence (Figure A16)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


#Table format results for Figure a17-----
###Outcome: Committee Made Right decision (Index)-----
rt_dec_ml_pool_int <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male*x_male_en + d_pro_dec+
            x_age + x_edu,
           fixed_effects = x_cntry,
           data = .) 

rt_dec_ml_jrd_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male*x_male_en + d_pro_dec+
            x_age + x_edu,
           se_type = "HC0",
           data = .)


rt_dec_ml_tns_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal +  x_male*x_male_en + d_pro_dec+
            x_age + x_edu,
           se_type = "HC0",
           data = .)



rt_dec_ml_mrc_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
att_cmt_ml_pool_int <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



att_cmt_ml_jrd_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


att_cmt_ml_tns_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



att_cmt_ml_mrc_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .)


### Outcome: Acceptance of Committee Decision------

accpt_cmt_ml_pool_int <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


accpt_cmt_ml_jrd_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .)


accpt_cmt_ml_tns_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



accpt_cmt_ml_mrc_int <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male*x_male_en + d_pro_dec +
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


###Create table for a17------
texreg(list(rt_dec_ml_pool_int, rt_dec_ml_jrd_int, rt_dec_ml_tns_int, rt_dec_ml_mrc_int,
            att_cmt_ml_pool_int, att_cmt_ml_jrd_int, att_cmt_ml_tns_int, att_cmt_ml_mrc_int,
            accpt_cmt_ml_pool_int, accpt_cmt_ml_jrd_int, accpt_cmt_ml_tns_int, accpt_cmt_ml_mrc_int),
       label = "tab:figure_a17",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Main Results Controlling for Enumerator Gender, Respondent Gender, and their Interaction (Figure A17)",
       font.size = "scriptsize",
       table = T,
       sideways = T)





#Table format result for Figure A18-----
##Outcome: Committee Made Right decision (Index)-----
rt_dec_ml_pool2 <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec*x_male + d_gen_bal+
            x_age + x_edu,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

rt_dec_ml_jrd2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec*x_male + d_gen_bal+
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



rt_dec_ml_tns2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec*x_male + d_gen_bal+
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


rt_dec_ml_mrc2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec*x_male + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


##Outcome: Attitudes Towards Committee (Index)-----
att_cmt_ml_pool2 <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec*x_male + d_gen_bal+  
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 




att_cmt_ml_jrd2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec*x_male + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



att_cmt_ml_tns2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec*x_male + d_gen_bal+ 
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)



att_cmt_ml_mrc2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec*x_male + d_gen_bal+  
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 



## Outcome: Acceptance of Committee Decision------

accpt_cmt_ml_pool2 <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec*x_male + d_gen_bal+  
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 




accpt_cmt_ml_jrd2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec*x_male + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .)



accpt_cmt_ml_tns2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec*x_male + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 




accpt_cmt_ml_mrc2 <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec*x_male + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



###Create table for a18------
texreg(list(rt_dec_ml_pool2, rt_dec_ml_jrd2, rt_dec_ml_tns2, rt_dec_ml_mrc2,
            att_cmt_ml_pool2, att_cmt_ml_jrd2, att_cmt_ml_tns2, att_cmt_ml_mrc2,
            accpt_cmt_ml_pool2, accpt_cmt_ml_jrd2, accpt_cmt_ml_tns2, accpt_cmt_ml_mrc2),
       label = "tab:figure_a18",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Respondents' Gender on Decision Treatment (Figure A18)",
       font.size = "scriptsize",
       table = T,
       sideways = T)

#Table format results for Figure A19-------
rt_dec_ml_pool_male <-
 gend_domv %>% 
 filter(.,
        x_male ==1) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+
            x_age + x_edu,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

rt_dec_ml_pool_female <-
 gend_domv %>% 
 filter(.,
        x_male ==0) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+
            x_age + x_edu,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

rt_dec_ml_jrd_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan",
        x_male ==1) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

rt_dec_ml_jrd_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan",
        x_male ==0) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

rt_dec_ml_tns_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia",
        x_male ==1) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



rt_dec_ml_tns_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia",
        x_male ==0) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

rt_dec_ml_mrc_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco",
        x_male ==1) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


rt_dec_ml_mrc_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco",
        x_male ==0) %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .) 




##Outcome: Attitudes Towards Committee (Index)-----
att_cmt_ml_pool_male <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>%
 filter(.,
        x_male ==1) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

att_cmt_ml_pool_female <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>%
 filter(.,
        x_male ==0) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


att_cmt_ml_jrd_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan",
        x_male==1) %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


att_cmt_ml_jrd_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan",
        x_male==0) %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

att_cmt_ml_tns_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia",
        x_male ==1) %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .)

att_cmt_ml_tns_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia",
        x_male == 0) %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .)




att_cmt_ml_mrc_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco",
        x_male == 1) %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

att_cmt_ml_mrc_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco",
        x_male == 0) %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


## Outcome: Acceptance of Committee Decision------

accpt_cmt_ml_pool_male <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 filter(.,
        x_male==1) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 



accpt_cmt_ml_pool_female <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 filter(.,
        x_male==0) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 


accpt_cmt_ml_jrd_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan",
        x_male == 1) %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .)


accpt_cmt_ml_jrd_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan",
        x_male == 0) %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+  
            x_age + x_edu,
           se_type = "HC0",
           data = .)

accpt_cmt_ml_tns_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia",
        x_male == 1) %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 




accpt_cmt_ml_tns_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia",
        x_male == 0) %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 



accpt_cmt_ml_mrc_male <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco",
        x_male == 1) %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 

accpt_cmt_ml_mrc_female <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco",
        x_male == 0) %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_pro_dec + d_gen_bal+ 
            x_age + x_edu,
           se_type = "HC0",
           data = .) 


###Create two table for Figure a19------
texreg(list(rt_dec_ml_pool_male, rt_dec_ml_jrd_male, rt_dec_ml_tns_male, rt_dec_ml_mrc_male,
            att_cmt_ml_pool_male, att_cmt_ml_jrd_male, att_cmt_ml_tns_male, att_cmt_ml_mrc_male,
            accpt_cmt_ml_pool_male, accpt_cmt_ml_jrd_male, accpt_cmt_ml_tns_male, accpt_cmt_ml_mrc_male),
       label = "tab:figure_a19_men",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Main Effects on Male Subsample (Figure A19)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


texreg(list(rt_dec_ml_pool_female, rt_dec_ml_jrd_female, rt_dec_ml_tns_female, rt_dec_ml_mrc_female,
            att_cmt_ml_pool_female, att_cmt_ml_jrd_female, att_cmt_ml_tns_female, att_cmt_ml_mrc_female,
            accpt_cmt_ml_pool_female, accpt_cmt_ml_jrd_female, accpt_cmt_ml_tns_female, accpt_cmt_ml_mrc_female),
       label = "tab:figure_a19_women",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Main Effects on Female Subsample (Figure A19)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


#Table format result of Figure A20------
##Outcome: Committee Made Right decision (Index)-----
reg_rt_dec_pool <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

reg_rt_dec_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

reg_rt_dec_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

reg_rt_dec_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
reg_att_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

reg_att_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

reg_att_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)


reg_att_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 

## Outcome: Acceptance of Committee Decision------

reg_accpt_cmt_pool <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           fixed_effects = x_cntry,
           se_type = "HC0",
           data = .) 

reg_accpt_cmt_jrd <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .)


reg_accpt_cmt_tns <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 




reg_accpt_cmt_mrc <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal*m_regime_sat + d_pro_dec+
            x_age + x_edu +x_male,
           se_type = "HC0",
           data = .) 


###Create two table for Figure a20------
texreg(list(reg_rt_dec_pool, reg_rt_dec_jrd, reg_rt_dec_tns, reg_rt_dec_mrc,
            reg_att_cmt_pool, reg_att_cmt_jrd, reg_att_cmt_tns, reg_att_cmt_mrc,
            reg_accpt_cmt_pool, reg_accpt_cmt_jrd, reg_accpt_cmt_tns, reg_accpt_cmt_mrc),
       label = "tab:figure_a20",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Moderating Effect of Regime Satisfaction (Figure A20)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


#Table format result for Figure A21---------
##Outcome: Committee Made Right decision (Index)-----
rt_dec_ml_pool_pn <-
 gend_domv %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec+
            x_age + x_edu + x_increase_domv_pen,
           fixed_effects = x_cntry,
           data = .) 


rt_dec_ml_jrd_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec+
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .)


rt_dec_ml_tns_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .) 



rt_dec_ml_mrc_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_right_dec_ix = standardize(y_right_dec_ix)) %>% 
 lm_robust(y_right_dec_ix ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .) 

##Outcome: Attitudes Towards Committee (Index)-----
att_cmt_ml_pool_pn <-
 gend_domv %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .)



att_cmt_ml_jrd_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .)


att_cmt_ml_tns_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .) 



att_cmt_ml_mrc_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_att_comittee = standardize(y_att_comittee)) %>% 
 lm_robust(y_att_comittee ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .) 


## Outcome: Acceptance of Committee Decision------

accpt_cmt_ml_pool_pn <-
 gend_domv %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .)



accpt_cmt_ml_jrd_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Jordan") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .) 

accpt_cmt_ml_tns_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Tunisia") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .) 



accpt_cmt_ml_mrc_pn <-
 gend_domv %>% 
 filter(.,
        x_cntry == "Morocco") %>% 
 mutate(.,
        y_public_accept = standardize(y_public_accept)) %>% 
 lm_robust(y_public_accept ~
            d_gen_bal + x_male + d_pro_dec +
            x_age + x_edu + x_increase_domv_pen,
           se_type = "HC0",
           data = .)
###Create table for Figure A21-----
texreg(list(rt_dec_ml_pool_pn, rt_dec_ml_jrd_pn, rt_dec_ml_tns_pn, rt_dec_ml_mrc_pn,
            att_cmt_ml_pool_pn, att_cmt_ml_jrd_pn, att_cmt_ml_tns_pn, att_cmt_ml_mrc_pn,
            accpt_cmt_ml_pool_pn, accpt_cmt_ml_jrd_pn, accpt_cmt_ml_tns_pn, accpt_cmt_ml_mrc_pn),
       label = "tab:figure_a21",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Right Decision" = 1:4,
                            "Attitude Committee" = 5:8,
                            "Public Accept" = 9:12),
       custom.model.names	= c("Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC",
                              "Pool", "JRD", 
                              "TNS", "MRC"),
       fontsize = "scriptsize",
       caption = "Main Results Controlling for Pre-Treatment Penalty Support (Figure A21)",
       font.size = "scriptsize",
       table = T,
       sideways = T)


#Table format result for Figure A22-------


corr_outcome <-
 gend_domv %>% 
 mutate(.,
        x_increase_domv_pen = case_when(
         x_increase_domv_pen == "Yes"~ 1,
         x_increase_domv_pen == "No"~ 0
        )) %>% 
 lm_robust(as.numeric(x_increase_domv_pen)~ m_sexism_ix + m_norms_ix +m_regime_sat+
            x_male,
           data = .) 

#Create Table for Figure A22------

texreg(list(corr_outcome),
       label = "tab:figure_a22",
       caption.above = T,
       no.margin = T,
       include.ci = FALSE,
       custom.header = list("Increase Penalty" = 1),
       fontsize = "scriptsize",
       caption = "Correlation of Key Moderators with Support for Increasing Penalties on DV Perpetrators (Figure A22)",
       font.size = "scriptsize")

